<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Request;
use Illuminate\Validation\Rule;
use Auth;

class BookRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules(Request $request)
    {
        switch ($this->method()) {
            case 'POST':
                $rules =  [
                    'ids' => 'array|required',
                    'ids.*' => 'exists:mysql_branch.fs_user,id',
                ];
                break;
            case 'DELETE':
                $rules = [
                    'ids' => 'array|required',
                    'ids.*' => 'exists:mysql_branch.fs_user,id',
                ];
        }

        return $rules;
    }

    public function attributes()
    {
        return [
            'ids' => '会员',
            'ids.*' => '会员',
        ];
    }
}
